#! /bin/sh
#-----------------------------------------------------------------------+
#									|
#   This material contains proprietary software of Entropic Speech,	|
#   Inc.  Any reproduction, distribution, or publication without the	|
#   prior written permission of Entropic Speech, Inc. is strictly	|
#   prohibited.  Any public distribution of copies of this work		|
#   authorized in writing by Entropic Speech, Inc. must bear the	|
#   notice								|
#									|
#    "Copyright (c) 1987 Entropic Speech, Inc. All rights reserved."	|
#									|
#-----------------------------------------------------------------------+
#									|
#  cover function for plotpit, plotsd, and plotpspec			|
#									|
#  by Rodney W. Johnson, Entropic Speech, Inc.				|
#									|
#  This command file runs the C program plotpit, plotsd, or plotspec,	|
#  depending on the name by which the command file is invoked.  It	|
#  pipes the output through various filter combinations selected by	|
#  the -T option							|
#									|
#-----------------------------------------------------------------------+
# Sccs information: @(#)plotsd	1.1  6/8/87

PLOTDIR1=$PLOTDIR$
PLOTDIR2=$PLOTDIR$

STOU=$PLOTDIR1/stou
PLOTAS=$PLOTDIR1/plotas
TPEN=$PLOTDIR1/tpen

case $0 in
plotpit)
    PLOT=$PLOTDIR2/plotpit ;;
*/plotpit)
    PLOT=$PLOTDIR2/plotpit ;;
plotsd)
    PLOT=$PLOTDIR2/plotsd ;;
*/plotsd)
    PLOT=$PLOTDIR2/plotsd ;;
plotspec)
    PLOT=$PLOTDIR2/plotspec ;;
*/plotspec)
    PLOT=$PLOTDIR2/plotspec ;;
esac

IPR="ipr -Ltektronix -D\"prerasterization on\""

device=mcd

# Get command-line options.

prevarg=
for i
do
    case $prevarg in
    -T)
	device=$i
	prevarg= ;;
    -t)
	command=$command" "\"$i\"
	prevarg= ;;
    "")
	case $i in
	-T)
	    prevarg=-T ;;
	-T*)
	    device=`echo $i | awk '{print substr($0, 3)}'` ;;
	-t)
	    command=$command" "$i
	    prevarg=-t ;;
	-t*)
	    command=$command" "-t" "\"`echo $i \
				    | awk '{print substr($0, 3)}'`\" ;;
	*)
	    command=$command" "$i ;;
	esac;;
    esac
done

case $prevarg in
-t)
    echo $PLOT: -t requires argument.
    exit 1 ;;
-T)
    echo $PLOT: -T requires argument.
    exit 1 ;;
esac

command=$PLOT" "$command

case $device in
gps)
    echo $command "|" $STOU \
	| sh -s ;;
mcd)
    tmp=/tmp/plot$$
    echo $command 2">"$tmp "|" $STOU "|" mcd \
	| sh -s
    cat $tmp
    rm $tmp ;;
tek)
    echo $command "|" $PLOTAS "|" $TPEN \
	| sh -s ;;
imagen)
    echo $command "|" $PLOTAS "|" $TPEN "|" $IPR \
	| sh -s ;;
esac
